//
//  HBSheetAction.m
//  HBActionSheet
//
//  Created by 韩冰 on 2017/10/23.
//  Copyright © 2017年 韩冰. All rights reserved.
//

#import "HBSheetAction.h"
#import "HBSheetView.h"


@implementation HBSheetAction

+(HBSheetView *)HB_CreateWithTitle:(NSString *)title withButtonArray:(NSArray *)buttonArray withCancle:(NSString *)cancle handler:(void (^)(NSInteger index))handerAction{
    
    HBSheetView *sheet = [[HBSheetView alloc]initWithTitle:title withButtonArray:buttonArray withCancleButton:cancle sheetType:HBSheetTypeNormal handler:^(NSInteger index) {
        if (handerAction) {
            handerAction (index);
        }
    }];
    HBPopupCompletionBlock completeBlock = ^(HBPopView *popupView, BOOL finished){
        NSLog(@"animation complete");
    };
    [sheet showWithBlock:completeBlock];
    
    return sheet;
}

+(HBSheetView *)HB_CreateWithButtonArray:(NSArray *)buttonArray withCancle:(NSString *)cancle handler:(void (^)(NSInteger index))handerAction{
    HBSheetView *sheet = [[HBSheetView alloc]initWithTitle:nil withButtonArray:buttonArray withCancleButton:cancle sheetType:HBSheetTypeNoTitle handler:^(NSInteger index) {
        if (handerAction) {
            handerAction (index);
        }
    }];
    HBPopupCompletionBlock completeBlock = ^(HBPopView *popupView, BOOL finished){
        NSLog(@"animation complete");
    };
    [sheet showWithBlock:completeBlock];
    
    return sheet;
    
}

+(HBSheetView *)HB_CreateWithTitle:(NSString *)title withButtonArray:(NSArray *)buttonArray handler:(void (^)(NSInteger index))handerAction{
    HBSheetView *sheet = [[HBSheetView alloc]initWithTitle:title withButtonArray:buttonArray withCancleButton:nil sheetType:HBSheetTypeNoCancel handler:^(NSInteger index) {
        if (handerAction) {
            handerAction (index);
        }
    }];
    HBPopupCompletionBlock completeBlock = ^(HBPopView *popupView, BOOL finished){
        NSLog(@"animation complete");
    };
    [sheet showWithBlock:completeBlock];
    
    return sheet;
    
}

+(HBSheetView *)HB_CreateWithButtonArray:(NSArray *)buttonArray handler:(void (^)(NSInteger index))handerAction{
    HBSheetView *sheet = [[HBSheetView alloc]initWithTitle:nil withButtonArray:buttonArray withCancleButton:nil sheetType:HBSheetTypeNoTitleAndCancel handler:^(NSInteger index) {
        if (handerAction) {
            handerAction (index);
        }
    }];
    HBPopupCompletionBlock completeBlock = ^(HBPopView *popupView, BOOL finished){
        NSLog(@"animation complete");
    };
    [sheet showWithBlock:completeBlock];
    
    return sheet;
    
}

@end
